home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / CBGRX100.ARJ / CLIPTEST.C < prev    next >
Text File  |  1992-04-10  |  2KB  |  57 lines

  1. /** 
  2.  ** CLIPTEST.C 
  3.  **
  4.  **  Copyright (C) 1992, Csaba Biegl
  5.  **    820 Stirrup Dr, Nashville, TN, 37221
  6.  **    csaba@vuse.vanderbilt.edu
  7.  **
  8.  **  This file is distributed under the terms listed in the document
  9.  **  "copying.cb", available from the author at the address above.
  10.  **  A copy of "copying.cb" should accompany this file; if not, a copy
  11.  **  should be available from where this file was obtained.  This file
  12.  **  may not be distributed without a verbatim copy of "copying.cb".
  13.  **  You should also have received a copy of the GNU General Public
  14.  **  License along with this program (it is in the file "copying");
  15.  **  if not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  16.  **  Cambridge, MA 02139, USA.
  17.  **
  18.  **  This program is distributed in the hope that it will be useful,
  19.  **  but WITHOUT ANY WARRANTY; without even the implied warranty of
  20.  **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  21.  **  GNU General Public License for more details.
  22.  **/
  23.  
  24.  
  25. #include "test.h"
  26.  
  27. TESTFUNC(cliptest)
  28. {
  29.     long delay;
  30.     int x = GrSizeX();
  31.     int y = GrSizeY();
  32.     int ww = (x * 2) / 3;
  33.     int wh = (y * 2) / 3;
  34.     int c;
  35.  
  36.     c = GrAllocColor(200,100,100);
  37.     GrBox(ww/4-1,wh/4-1,ww/4+ww+1,wh/4+wh+1,GrWhite());
  38.     GrSetClipBox(ww/4,wh/4,ww/4+ww,wh/4+wh);
  39.  
  40.     drawing(0,0,ww,wh,c,GrBlack());
  41.     getkey();
  42.  
  43.     while(!kbhit()) {
  44.         GrFilledBox(0,0,x,y,GrBlack());
  45.         drawing(-(random()%(2*ww))+ww/2,
  46.         -(random()%(2*wh))+wh/2,
  47.         random()%(3*ww)+10,
  48.         random()%(3*wh)+10,
  49.         c,
  50.         GrNOCOLOR
  51.         );
  52.         for(delay = 200000L; delay > 0L; delay--);
  53.     }
  54.     getkey();
  55. }
  56.  
  57.